package com.shopping.serviceImpl;

import com.shopping.dao.CartDao;
import com.shopping.pojo.Cart;
import com.shopping.pojo.vo.ProductCartInfo;
import com.shopping.pojo.vo.ProductInfo;
import com.shopping.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CartServiceImpl implements CartService {
    @Autowired
    private CartDao cartDao;

    @Override
    public Cart isCart(Integer userId, Integer productId,Integer specId) {
        return cartDao.isCart(userId,productId,specId);
    }

    @Override
    public boolean insertCart(Cart cart) {
        return cartDao.insertCart(cart)>0;
    }

    @Override
    public boolean updateCartNumInc(Integer cartId) {
        return cartDao.updateCartNumInc(cartId)>0;
    }

    @Override
    public boolean updateCartNumDec(Integer cartId) {
        return cartDao.updateCartNumDec(cartId)>0;
    }

    @Override
    public boolean deleteCart(Integer cartId) {
        return cartDao.deleteCart(cartId)>0;
    }

    @Override
    public List<ProductCartInfo> selectCartByUserId(Integer userId,String productName) {
        return cartDao.selectCartByUserId(userId,productName);
    }
}
